<?php

declare(strict_types=1);

namespace App\Controller\Grpc\Server;

use App\Model\Authentication\Admin;
use Grpc\Reply;
use Grpc\Params;

class AdminController
{
    public function GetInfo(Params $params)
    {
        $message = new Reply();

        $request = json_decode($params->getMessage(), true);

        $admin_id = $request['admin_id'] ?? 0;

        $admin_info = Admin::find($admin_id);

        $message->setMessage(json_encode($admin_info, JSON_UNESCAPED_UNICODE));

        return $message;
    }
}
